package com.zhm.demo.es;

import com.alibaba.excel.metadata.property.StyleProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.zhm.demo.utils.GeoJson;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.framework.qual.FieldInvariant;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Document(indexName = "iot_device_image")
@Setting(shards = 3, replicas = 2)
public class IotDeviceImage {

    @Id
    private String id;
    public static final String KEY_ID = "id";

    @Field(type = FieldType.Date, index = false)
    private Date date;


    @Field(type = FieldType.Date, index = false)
    private Long ts;

    /**
     * 协议版本
     */
    @Field(type = FieldType.Keyword, index = false)
    private String protocolKey;


    @Field(type = FieldType.Keyword)
    private String productKey;


    @Field(type = FieldType.Keyword)
    private String timezone;

    /**
     * 设备编码
     */
    @Field(type = FieldType.Keyword)
    private String sn;

    @Field(type = FieldType.Long)
    private Long deviceId;

    private Map<String, Object> paramMap;

    @GeoPointField
    private GeoPoint location;

    @Field(type = FieldType.Long)
    private List<Long> userIdList;

    @Field(type = FieldType.Long)
    private Long ownerId;

    @Field(type = FieldType.Long)
    private Long tenantId;

    @Field(type = FieldType.Long)
    private Long productId;

    @Field(type = FieldType.Long)
    private Long siteId;



}
